import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type ResultType = {
  /** 状态码 200成功 */
  code: number;
  /** 接口返回信息 */
  message: string;
  /** 数据 */
  data: any;
};

/** 打卡列表 pageNub：第几页 pageSize：每页大小 userId:0查全部, 自己id查自己*/
export const recordList = (pageNub: number, pageSize: number, userId: number, data?: object) => {
  return http.request<ResultType>("post", baseUrlApi("card/recordList/" + pageNub + "/" + pageSize + "/" + userId), { data });
};

/** 打卡或修改 type=1打卡 2修改 */
export const updateOrAddRecord = (type: number, data?: object) => {
  return http.request<ResultType>("post", baseUrlApi("card/updateOrAddRecord/" + type), { data });
};

/** 用户删除 */
export const deleteRecordById = (id: number) => {
  return http.request<ResultType>("get", baseUrlApi("card/deleteRecordById/" + id));
};
